package model

import (
	"awesomeProject2/global"
	"gorm.io/gorm"
)

type Config struct {
	gorm.Model
	Year    int  `gorm:"type:int"`
	Is_Open bool `gorm:"type:tinyint"`
}

func GetYear() int {
	var data Config
	global.GVA_DB.Where("ID = ?", 1).First(&data)
	return data.Year
}
func UpdateConfig(year int) error {
	err := global.GVA_DB.Model(&User{}).Where("id = ?", 1).Update("year", year).Error
	return err
}
